package com.ruiysoft.website.service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.ruiysoft.website.entity.CmsLeavecomments;
import com.ruiysoft.website.mapper.CmsLeavecommentsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by liudh on 2019/4/25.
 */

@Service
public class CmsLeaveCommentsService {
    @Autowired
    CmsLeavecommentsMapper cmsLeavecommentsMapper;

    public List<CmsLeavecomments> selectList(String enterpriseId) {
        EntityWrapper<CmsLeavecomments> ew = new EntityWrapper();

        List columns = new ArrayList();
        columns.add("createTime");
        columns.add("sequence");

        ew.eq("enterpriseId", enterpriseId).orderDesc(columns);

        return cmsLeavecommentsMapper.selectList(ew);
    }

    public int save(CmsLeavecomments cmsLeavecomments) {
        return cmsLeavecommentsMapper.insert(cmsLeavecomments);
    }
}
